var t = require;
var e = module;
var o = exports;
var a,
    i =
        (this && this.__extends) ||
        ((a = function (t, e) {
            return (a =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                })(t, e);
        }),
        function (t, e) {
            a(t, e);
            function o() {
                this.constructor = t;
            }
            t.prototype = null === e ? Object.create(e) : ((o.prototype = e.prototype), new o());
        }),
    n =
        (this && this.__decorate) ||
        function (t, e, o, a) {
            var i,
                n = arguments.length,
                r = n < 3 ? e : null === a ? (a = Object.getOwnPropertyDescriptor(e, o)) : a;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, a);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (i = t[s]) && (r = (n < 3 ? i(r) : n > 3 ? i(e, o, r) : i(e, o)) || r);
            return n > 3 && r && Object.defineProperty(e, o, r), r;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var r = cc._decorator,
    s = r.ccclass,
    c = r.property,
    p =
        (r.menu,
        (function (t) {
            i(e, t);
            function e() {
                var e = (null !== t && t.apply(this, arguments)) || this;
                e.indexNode = [];
                e.backView = [];
                e.frontView = [];
                e.tailSprite = null;
                e.bodySprite = null;
                e.weijinSprite = null;
                e.rightHandSprite = null;
                e.leftHandSprite = null;
                e.eyesSprite = null;
                e.faceSprite = null;
                e.hatSprite = null;
                e.armsSprite = null;
                e.armAnge = 0;
                return e;
            }
            e.prototype.setFrontEquit = function (t, e, o) {
                this.setSpriteCostumetpsView(e, this.weijinSprite);
                this.setSpriteCostumetpsView(t, this.hatSprite);
                this.setSpriteCostumetpsView(o, this.armsSprite);
            };
            e.prototype.setHatPos = function (t, e) {
                void 0 === e && (e = "");
                if (t) {
                    if (t[1]) {
                        this.hatSprite.node.setPosition(cc.v2(t[1].x, t[1].y));
                        t[1].r && (this.hatSprite.node.angle = t[1].r);
                    }
                    if (t[2]) {
                        this.weijinSprite.node.setPosition(cc.v2(t[2].x, t[2].y));
                        t[2].r && (this.weijinSprite.node.angle = t[2].r);
                    }
                    if (t[3]) {
                        this.armsSprite.node.setPosition(cc.v2(t[3].x, t[3].y));
                        if (t[3].r) {
                            this.armsSprite.node.angle = t[3].r;
                            this.armAnge = this.armsSprite.node.angle;
                        }
                    }
                }
            };
            e.prototype.setBackEquit = function (t, e, o) {
                this.setSpriteCostumetpsView(e, this.weijinSprite);
                this.setSpriteCostumetpsView(t, this.hatSprite);
                this.setSpriteCostumetpsView(o, this.armsSprite);
            };
            e.prototype.setFrontSkin = function (t, e, o, a, i) {
                this.setSpriteCatView(t, this.bodySprite);
                this.setSpriteCatView(e, this.eyesSprite);
                this.setSpriteCatView(o, this.faceSprite);
                this.setSpriteCatView(a, this.rightHandSprite);
                this.setSpriteCatView(a, this.leftHandSprite);
                this.setSpriteCatView(i, this.tailSprite);
                this.weijinSprite.spriteFrame = null;
                this.hatSprite.spriteFrame = null;
                this.setIndexNode(this.indexNode);
                this.setIndexNode(this.frontView);
            };
            e.prototype.setIndexNode = function (t, e) {
                void 0 === e && (e = 0);
                for (var o = 0; o < t.length; o++) t[o].zIndex = e + o;
            };
            e.prototype.setIndexNodeRec = function (t) {
                for (var e = 0; e < t.length; e++) t[e].zIndex = t.length - e;
            };
            e.prototype.setBackSkin = function (t, e, o) {
                this.setSpriteCatView(t, this.bodySprite);
                this.setSpriteCatView(e, this.tailSprite);
                this.setSpriteCatView(o, this.rightHandSprite);
                this.setSpriteCatView(o, this.leftHandSprite);
                this.faceSprite.spriteFrame = null;
                this.weijinSprite.spriteFrame = null;
                this.hatSprite.spriteFrame = null;
                this.eyesSprite.spriteFrame = null;
                this.setIndexNodeRec(this.indexNode);
                this.setIndexNode(this.backView);
            };
            e.prototype.lateUpdate = function () {
                this.armsSprite.node.angle != this.armAnge && (this.armsSprite.node.angle = this.armAnge);
            };
            e.prototype.setSpriteCatView = function (t, e) {
                "" != t && "undefined" != t
                    ? BundleManager.setSpriteAtlas(BundleManager.bn.Res, "/UI/catAnimal/cat", t, e)
                    : (e.spriteFrame = null);
            };
            e.prototype.setSpriteCostumetpsView = function (t, e) {
                BundleManager.setSpriteAtlas(BundleManager.bn.Res, "/UI/costume/costumetps", t, e);
            };
            n([c([cc.Node])], e.prototype, "indexNode", void 0);
            n([c([cc.Node])], e.prototype, "backView", void 0);
            n([c([cc.Node])], e.prototype, "frontView", void 0);
            n([c({type: cc.Sprite, displayName: "尾巴"})], e.prototype, "tailSprite", void 0);
            n([c({type: cc.Sprite, displayName: "身体"})], e.prototype, "bodySprite", void 0);
            n([c({type: cc.Sprite, displayName: "围巾"})], e.prototype, "weijinSprite", void 0);
            n([c({type: cc.Sprite, displayName: "右手"})], e.prototype, "rightHandSprite", void 0);
            n([c({type: cc.Sprite, displayName: "左手"})], e.prototype, "leftHandSprite", void 0);
            n([c({type: cc.Sprite, displayName: "眼睛"})], e.prototype, "eyesSprite", void 0);
            n([c({type: cc.Sprite, displayName: "脸"})], e.prototype, "faceSprite", void 0);
            n([c({type: cc.Sprite, displayName: "帽子"})], e.prototype, "hatSprite", void 0);
            n([c({type: cc.Sprite, displayName: "武器"})], e.prototype, "armsSprite", void 0);
            return n([s], e);
        })(cc.Component));
o.default = p;
